package com.crr.config;


import com.crr.ex.LazyExchange;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class LazyConfig {
    /**
     * 延迟队列
     * @return
     */
    @Bean
    public Queue lazyQueue(){
       return new Queue("lazy-Queue");
    }

    /**
     * 延迟交换器
     * @return
     */
    @Bean
    public LazyExchange lazyExchange(){
        return new LazyExchange("lazy-ex");
    }
    @Bean
    public Binding binding(LazyExchange lazyExchange , Queue lazyQueue){
        return BindingBuilder.bind(lazyQueue).to(lazyExchange).with("lazy").noargs();
    }
}
